156 PART 4 Comparing Groups

But Bonferroni is not commonly used in statistical software. In R, the most com-

mon post-hoc adjustments employed are Tukey-Kramer (using the TukeyHSD

command) and Scheffe (using the ScheffeTest command from the package Desc-

Tools). The reason why the Tukey HSD is not available in R is that the Tukey-

Kramer can handle both balanced and unbalanced groups. In the case of marital

statuses and fasting glucose levels in NHANES, the Tukey-Kramer is probably the

most appropriate test because we do not need the special features of the Scheffe

test. However, we explain the output anyway so that you can understand how to

interpret it.

To run the Tukey-Kramer test in R, we use the following code: TukeyHSD(GLUCOSE_

aov, conf.level=.95). Notice that the code refers to the ANOVA object we made previ-

ously called GLUCOSE_aov. The Tukey-Kramer output begins by restating the

test, and the contents of the ANOVA object GLUCOSE_aov.

Next is a table (also known as a matrix) with five columns. The first column does

not have a heading, but indicates which levels of MARITAL are being compared in

each row (for example, 2-1 means that 1 = M is being compared to 2 = NM). The

column diff indicates the mean difference between the groups being compared,

with lwr and upr referring to the lower and upper 95 percent confidence limits of

this difference, respectively. (R is using the 95 percent confidence limits because

we specified conf.level = .95 in our code.) Finally, in the last column labeled p adj is

the p value for each test. As you can see by the output, using the Tukey-Kramer

test and α = 0.05, M and NM are statistically significantly different (p = 0.0000102),

and OTH and M are statistically significantly different (p = 0.0030753), but NM and

OTH are not statistically significantly different (p = 0.1101964).

When doing a set of post-hoc tests in any software, the output will be formatted

as a table, with each comparison listed on its own row, and information about the

comparison listed in the columns.

In a real scenario, after completing your post-hoc test, you would stop here and

interpret your findings. But because we want to explain the Scheffe test, we can

take an opportunity compare what we find when we run that one, too. Let’s start

by loading the DescTools package using the R code library(DescTools) (Chapter 4

explains how to use packages in R). Next, let’s try the Scheffe test by using the

following code on our existing ANOVA object: ScheffeTest(GLUCOSE_aov).

The Scheffe test output is arranged in a similar matrix, but also includes R’s sig-

nificance codes. This time, according to R’s coding system, M and NM are statisti-

cally significantly different at p < 0.001, and M and OTH are statistically significantly

different at p < 0.01. Although the actual numbers are slightly different, the inter-

pretation is the same as what you saw using the Tukey-Kramer test.